const fs = require('fs');
const https = require('https')
const config = {
  hostname: 'https://www.zhihu.com/video/1282057079432196096',
  port: 443,
  path: '/',
  method: 'GET',
  agent: false
}
const writeFile = fs.createWriteStream('./test.mp4')
videoUrl = 'https://vdn1.vzuu.com/LD/b72839dc-e79a-11ea-89af-7a29ffccff66.mp4?disable_local_cache=1&bu=http-com&expiration=1603098782&auth_key=1603098782-0-0-f04777551bf5c1a5111f3f5b6fb77cc5&f=mp4&v=hw'
var req = https.get(videoUrl, function (data) {
  data.on('data', function (chunk) {
    console.log('响应内容: ' + chunk);
    // writeFile.write(chunk)
    chunk.pipe(writeFile)
  });
  data.on('end', function () {
    write.end()
  })
});
